/*
 * MineralKineticsDatabase.h
 *
 *  Created on: 15 Jul 2011
 *      Author: al2010
 */

#ifndef MINERALKINETICSDATABASE_H_
#define MINERALKINETICSDATABASE_H_

// C++ includes
#include <list>
using namespace std;

// Boost includes
#include <boost/optional.hpp>
using boost::optional;

// GeoReact includes
#include "../../Utils.h"
#include "MineralKinetics.h"

struct MineralKineticsInfo
{
	/// The name of the mineral whose the rate information is defined for
	string mineralName;
	
	/// The specific surface area of the mineral
	double specificSurfaceArea;
	
	/// The mineral rate mechanisms of the mineral dissolution/precipitation reaction
	vector<MineralKinetics::Mechanism> mechanisms;
};

class MineralKineticsDatabase
{
public:
	typedef list<MineralKineticsInfo>
	MineralKineticsInfoList;
	
public:
	static const MineralKineticsDatabase& 
	GetInstance();
	
	const MineralKineticsInfoList&
	GetMineralKineticsInfoList() const;
	
	const MineralKineticsInfo
	GetMineralKineticsInfo(const string& mineralName) const;
	
	const optional<MineralKineticsInfo>
	FindMineralKineticsInfo(const string& mineralName) const;
	
private:
	MineralKineticsDatabase();
	
	const double
	GetFromLineSpecificSurfaceArea(const string& surfAreaLine) const;
	
	const string
	GetFromLineMechanismName(const string& mechanismLine) const;
	
	const double
	GetFromLineRateConstant(const string& mechanismLine) const;
	
	const double
	GetFromLineActivationEnergy(const string& mechanismLine) const;
	
	const vector<MineralKinetics::Catalyst>
	GetFromLineCatalysts(const string& mechanismLine) const;
	
	const MineralKinetics::Mechanism
	GetFromLineMechanism(const string& mechanismLine) const;
	
private:
	MineralKineticsInfoList mineralRateInfoList;
};

#endif /* MINERALKINETICSDATABASE_H_ */
